package com.changgou.page.listener;

import com.changgou.page.config.RabbitmqConfig;
import com.changgou.page.service.PageService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: 大佬味的小男孩
 * @date: 2020-07-27 23:51
 **/
@Component
public class PageListener {

    @Autowired
    private PageService pageService;

    @RabbitListener(queues = RabbitmqConfig.PAGE_CREATE_QUEUE)
    public void receiveMessage(String spuId) {
        System.out.println("生成静态页面的spuId:" + spuId);
        pageService.generateHtml(spuId);
    }
}
